package com.xhwl.data.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.data.service.IPositionExcelRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: lrp
 * @Description: 岗位管理数据导入历史信息
 * @Date: Create in 2022/01/22 10:45
 */
@RestController
public class PositionExcelRecordController {

    @Autowired
    private IPositionExcelRecordService positionExcelRecordService;

    /**
     * 导入历史分页查询
     * @param enterpriseId
     * @param fileName
     * @param page
     * @return
     */
    @GetMapping("/position-excel-record/page")
    public ResultJson page(@RequestParam(value = "enterpriseId", required = true) Integer enterpriseId,
                           @RequestParam(value = "fileName", required = false) String fileName,
                           Page page) {
        return ResultJson.success(positionExcelRecordService.page(enterpriseId, fileName, page));
    }


    /**
     * 下载导入失败表格
     * @param id
     * @return
     */
    @GetMapping(value = "/position-excel-record/fail-download")
    public ResultJson failDownload(@RequestParam(value = "id", required = true) Integer id) {
        return positionExcelRecordService.getFailExcelUrl(id);
    }
}
